'''
Created on Jun 14, 2009

@author: trevor
'''


import random,copy

class ModInst(object):
    
    def __init__(self):
        self.value = random.randint(0,100)


def Creator():
    return ModInst()

def AboveThreshold(obj):
    if obj.value > 0:
        return True
    else:
        return False

def Mutator(obj):
    temp = copy.deepcopy(obj)
    if random.random() > .51:
        temp.value = temp.value + (random.random() * 10)
    else:
        temp.value = temp.value - (random.random() * 10)
    
    return temp
    
def Printable(obj):
    return obj.value

def Comparor(obj_one, obj_two):
    if obj_one.value < obj_two.value:
        return True
    else:
        return False
    
def Differencer(obj_one, obj_two):
    #return (obj_one.value - obj_two.value)
    if obj_one.value < obj_two.value:
        return -1
    else:
        return 1
